﻿/*****************************************************************************/
/* Stored Procedure :: CountGrantsFor                                        */
/*****************************************************************************/
CREATE PROCEDURE [GrantManagement].[CountGrantsFor]
(
	@VolunteerID BIGINT
)
AS  
BEGIN

	SELECT COUNT(Grants.OID)
	FROM  Grants
	INNER JOIN Cases On Grants.CaseID = Cases.OID
	INNER JOIN People On Cases.ServiceManID = People.OID
	WHERE ([GrantManagement].[fnCanViewGrant](Grants.OID, @VolunteerID) = 1)

END
